<?php

/**
 * statystyki actions.
 *
 * @package    edmuch
 * @subpackage statystyki
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class statystykiActions extends sfActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeIndex(sfWebRequest $request)
  {
    $this->user = $this->getUser()->getGuardUser();
    
    $userid = $this->getUser()->getGuardUser()->getId();
    
    $this->game_results = Doctrine::getTable('GameResult')
      ->createQuery('a')
      ->select('a.score, COUNT(a.score) as ilosc, MAX(a.score) as max_pkt, AVG(a.score) as avg_pkt')
      ->where('a.user_id = ?', $userid)
      ->groupBy('a.games_id')
      ->execute();
    
  }
}
